package com.bbx.taxi.client.Util;

import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.example.Util.DensityUtil;

/**
 * @Path com.bbx.taxi.client.Util.LayoutParamsUitls.java
 * @Author 严旭文
 * @Date 2016-7-27 下午12:00:16
 * @Company 蓝海（福建）信息技术有限公司
 * @Description
 */
public class LayoutParamsUitls {
	public static void setMargin(View v, int left, int top, int right,
			int bottom) {
		try {
			RelativeLayout.LayoutParams lp = (android.widget.RelativeLayout.LayoutParams) v
					.getLayoutParams();
			lp.setMargins(left, top, right, bottom);
			v.setLayoutParams(lp);
		} catch (Exception e) {
			try {
				LinearLayout.LayoutParams lp = (android.widget.LinearLayout.LayoutParams) v
						.getLayoutParams();
				lp.setMargins(left, top, right, bottom);
				v.setLayoutParams(lp);
			} catch (Exception e2) {
			}
		}
	}
	public static void setSize(View v, int width,int height) {
		try {
			RelativeLayout.LayoutParams lp = (android.widget.RelativeLayout.LayoutParams) v
					.getLayoutParams();
			lp.width=width;
			lp.height=height;
			v.setLayoutParams(lp);
		} catch (Exception e) {
			try {
				LinearLayout.LayoutParams lp = (android.widget.LinearLayout.LayoutParams) v
						.getLayoutParams();
				lp.width=width;
				lp.height=height;
				v.setLayoutParams(lp);
			} catch (Exception e2) {
			}
		}
	}
}
